/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bungabungaball;

import com.esotericsoftware.kryonet.Client;
import com.esotericsoftware.kryonet.Server;
import org.newdawn.slick.Input;

import org.newdawn.slick.GameContainer;

/**
 * Contains information of the game, with that the player can be controlled
 * @author Ingo Klose, Stephan Meyer, Sebastian Lehmann
 * @version 1.0
 */
public class PlayerControl {
    /***
     * A KryoNet Server
     */
    public static Server server;
    /**
     * A KryoNet Client
     */
    public static Client client;
    /**
     * The Slick2d Input
     */
    public static Input input;
    /***
     * The Slick2d GameContainer
     */
    public GameContainer gameContainer;
    /***
     * The Ball Position x
     */
    public int ballPositionX;
    /***
     * The Ball Position y
     */
    public int ballPositionY;
    /**
     * The size of the goal
     */
    public float goalSize;
    /**
     * Own goal position x
     */
    public float p1GoalX;
    /**
     * Own goal position y
     */
    public float p1GoalY;
    /**
     * Other players goal position x
     */
    public float opponentsGoalX;
    /**
     * Other players goal position y
     */
    public float opponentsGoalY;
    /**
     * Center of game x
     */
    public float mittelpunktX;
    /**
     * Center of game x
     */
    public float mittelpunktY;
    /**
     * Size of game x
     */
    public float fieldSzX;
    /**
     * Size of game y
     */
    public float fieldSzY;
    
    /***
     * Constructor
     * @param pgc
     * @param MittelpunktX
     * @param MittelpunktY
     * @param fieldSizeX
     * @param fieldSizeY
     * @param GoalSize 
     */
    public PlayerControl(GameContainer pgc, float MittelpunktX, float MittelpunktY, float fieldSizeX, float fieldSizeY, float GoalSize){
        
        this.gameContainer = pgc;
        this.mittelpunktX = MittelpunktX;
        this.mittelpunktY = MittelpunktY;
        this.fieldSzX = fieldSizeX;
        this.fieldSzY = fieldSizeY;
        this.getMyGoalPosition(MittelpunktX, MittelpunktY, fieldSizeX, GoalSize);
        this.getOpponentsGoalPosition(MittelpunktX, MittelpunktY, fieldSizeX, GoalSize);
    }
    
    /**
     * Set the Position of the ball
     * @param x
     * @param y 
     */
    public void setBallPosition(int x, int y){
        this.ballPositionX = x;
        this.ballPositionY = y;
        
    }
    
    /**
     * Set own goal position
     * @param MittelpunktX
     * @param MittelpunktY
     * @param fieldSizeX
     * @param GoalSize 
     */
    public void getMyGoalPosition(float MittelpunktX, float MittelpunktY, float fieldSizeX, float GoalSize){
        this.goalSize = GoalSize;
        this.p1GoalX = MittelpunktX + fieldSizeX/2;
        this.p1GoalY =  MittelpunktY;
        
    }
    
    /***
     * Set opponents goal position
     * @param MittelpunktX
     * @param MittelpunktY
     * @param fieldSizeX
     * @param GoalSize 
     */
    public void getOpponentsGoalPosition(float MittelpunktX, float MittelpunktY, float fieldSizeX, float GoalSize){
        this.opponentsGoalX = MittelpunktX - fieldSizeX/2;
        this.opponentsGoalY = MittelpunktY;
    }
    
}
